<?php

class Core_Controller_Admincp_Phrase_Delete extends Nuo_Controller_Admincp
{
	function execute($request)
	{
		$id = $request -> getParam('phrase_id');

		$table = Nuo::getTable('core/phrase');

		$form = Nuo::getObject('core/admincp/phrase/delete', 'form');

		$item = NULL;

		if ($id)
		{
			$item = $table -> find($id) -> current();
		}

		if ($request -> isGet() && $item)
		{
			$form -> setData($item -> toArray());
		}

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$item -> delete();
			
			
			return  array('jscript'=>'nuo.refresh();'); 
			return ;
			
		}

		return  Nuo::getView()->render('core/view/controller/admincp/edit', array('form' => $form));
	}

}
